package com.yonyou.cyxdms.sysAuth.service.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.yonyou.cyx.framework.bean.dto.base.BaseDTO;
import com.yonyou.cyx.function.utils.bean.BeanMapperUtil;
import com.yonyou.cyxdms.framework.bean.entity.base.DMSBasePO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * 菜单信息
 *
 * @author quankk
 * @since 2019-07-05
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("tc_menu")
public class MenuPO extends DMSBasePO<MenuPO> {

    private static final long serialVersionUID = 1L;

    /**
     * 菜单ID
     */
    @TableId(value = "MENU_ID", type = IdType.AUTO)
    private Long menuId;

    /**
     * 排序
     */
    @TableField("`RANK`")
    private Integer rank;

    @TableField("APP_ID")
    private String appId;

    /**
     * 菜单名
     */
    @TableField("MENU_NAME")
    private String menuName;

    /**
     * 菜单名拼音首字母
     */
    @TableField(value = "MENU_PY", exist = false)
    private String menuPy;

    /**
     * 菜单URL
     */
    @TableField("MENU_URL")
    private String menuUrl;

    /**
     * 菜单图标
     */
    @TableField("MENU_ICON")
    private String menuIcon;

    /**
     * 菜单描述
     */
    @TableField("MENU_DESC")
    private String menuDesc;

    /**
     * 菜单英文名
     */
    @TableField("MENU_NAME_EN")
    private String menuNameEn;

    /**
     * 父级菜单ID
     */
    @TableField("PARENT_ID")
    private Integer parentId;

    /**
     * 菜单状态(10011001有效,10011002无效)
     */
    @TableField("MENU_STATUS")
    private Integer menuStatus;

    /**
     * 菜单类型(OEM、DEALER)
     */
    @TableField("MENU_TYPE")
    private Integer menuType;

    /**
     * 菜单分类(PC、APP)
     */
    @TableField("MENU_CATEGORY")
    private Integer menuCategory;

    @TableField("DATA_TYPE")
    private Integer dataType;

    @Override
    protected Serializable pkVal() {
        return this.menuId;
    }

    /**
     * 将PO 信息转化为DTO
     *
     * @param dto 需要进行转换的dto
     * @author quankk
     * @since 2018/7/22 0022
     */
    protected <T extends BaseDTO> void transDtoToPo(T dto) {
        BeanMapperUtil.copyProperties(this, dto, "menuId");
    }

}
